﻿using System;
using System.Data;
using System.Collections.Generic;
using FiberRMS.Model.AlarmManager;
namespace FiberRMS.BLL.AlarmManager
{
	/// <summary>
	/// 业务逻辑类ALARM_FILTER 的摘要说明。
	/// </summary>
	public class ALARM_FILTER
	{
		private readonly FiberRMS.DAL.AlarmManager.ALARM_FILTER dal=new FiberRMS.DAL.AlarmManager.ALARM_FILTER();
		public ALARM_FILTER()
		{}
		#region  成员方法
        /// <summary>
        /// 获得告警映射信息
        /// </summary>
        /// <returns></returns>
        public DataTable GetAlarmMap(string strWhere, string userid, bool isAdd)
        {
            return dal.GetAlarmMap(strWhere,userid,isAdd);
        }
        /// <summary>
        /// 获取alarmfilter、alarmmap联查结果
        /// </summary>
        /// <returns></returns>
        public DataTable GetFilters(string userid)
        {
            return dal.GetFilters(userid);
        }
        public int GetMaxID()
        {
            return dal.GetMaxID();
        }
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(string ALARMFILTERID)
		{
			return dal.Exists(ALARMFILTERID);
		}

		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(FiberRMS.Model.AlarmManager.ALARM_FILTER model)
		{
			return dal.Add(model);
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(FiberRMS.Model.AlarmManager.ALARM_FILTER model)
		{
			return dal.Update(model);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public void Delete(string ALARMFILTERID)
		{
			
			dal.Delete(ALARMFILTERID);
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public FiberRMS.Model.AlarmManager.ALARM_FILTER GetModel(string ALARMFILTERID)
		{
			
			return dal.GetModel(ALARMFILTERID);
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return dal.GetList(strWhere);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<FiberRMS.Model.AlarmManager.ALARM_FILTER> GetModelList(string strWhere)
		{
			DataSet ds = dal.GetList(strWhere);
			List<FiberRMS.Model.AlarmManager.ALARM_FILTER> modelList = new List<FiberRMS.Model.AlarmManager.ALARM_FILTER>();
			int rowsCount = ds.Tables[0].Rows.Count;
			if (rowsCount > 0)
			{
				FiberRMS.Model.AlarmManager.ALARM_FILTER model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new FiberRMS.Model.AlarmManager.ALARM_FILTER();
					model.ALARMFILTERID=ds.Tables[0].Rows[n]["ALARMFILTERID"].ToString();
					model.FILTERNAME=ds.Tables[0].Rows[n]["FILTERNAME"].ToString();
					if(ds.Tables[0].Rows[n]["CREATETIME"].ToString()!="")
					{
						model.CREATETIME=DateTime.Parse(ds.Tables[0].Rows[n]["CREATETIME"].ToString());
					}
					model.ISUSE=ds.Tables[0].Rows[n]["ISUSE"].ToString();
					model.ALARMMAPID=ds.Tables[0].Rows[n]["ALARMMAPID"].ToString();
					modelList.Add(model);
				}
			}
			return modelList;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetAllList()
		{
			return GetList("");
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		//{
			//return dal.GetList(PageSize,PageIndex,strWhere);
		//}

		#endregion  成员方法
	}
}






